//
//  RootTabBarController.m
//  LoveHealth
//
//  Created by 陈永坤 on 14-9-18.
//  Copyright (c) 2014年 lanou. All rights reserved.
//

#import "RootTabBarController.h"
#import "HealthNewsListViewController.h"
#import "HealthFoodListViewController.h"

#import "UserInfoViewController.h"
#import "HealthKnowledgeClassViewController.h"
#import "HandleUserInterface.h"
#import "HostViewController.h"
#import "SQLHelper.h"
@interface RootTabBarController ()

@end

@implementation RootTabBarController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    

    //健康资讯
    HostViewController * newsListVC = [[HostViewController alloc]init];
    UINavigationController * newsListNC = [[UINavigationController alloc]initWithRootViewController:newsListVC];
    newsListNC.navigationBar.barTintColor = [HandleUserInterface getCommonColor];
    newsListNC.tabBarItem.title = @"健康资讯";
    newsListNC.tabBarItem.image = [UIImage imageNamed:@"tab_news"];
    //选中时图片
    //newsListNC.tabBarItem.selectedImage = [HandleUserInterface handleImage:@"tab_news"];
    //选中时title颜色
    //[newsListNC.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[HandleUserInterface getCommonColor],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
    
    //健康常识
    HealthKnowledgeClassViewController * knowledgeListVC = [[HealthKnowledgeClassViewController alloc]init];
    UINavigationController * knowledgeListNC = [[UINavigationController alloc]initWithRootViewController:knowledgeListVC];
    knowledgeListNC.navigationBar.barTintColor = [HandleUserInterface getCommonColor];
    knowledgeListNC.tabBarItem.title = @"健康常识";
    knowledgeListNC.tabBarItem.image = [UIImage imageNamed:@"tab_knowledge"];
    //knowledgeListNC.tabBarItem.selectedImage = [HandleUserInterface handleImage:@"tab_knowledge"];
   // [knowledgeListNC.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[HandleUserInterface getCommonColor],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
  

    //健康食谱
    HealthFoodListViewController * foodListVC = [[HealthFoodListViewController alloc]init];
    UINavigationController * foodListNC = [[UINavigationController alloc]initWithRootViewController:foodListVC];
    foodListNC.navigationBar.barTintColor = [HandleUserInterface getCommonColor];
    foodListNC.tabBarItem.title = @"健康食谱";
    foodListNC.tabBarItem.image = [UIImage imageNamed:@"tab_food"];
    //foodListNC.tabBarItem.selectedImage = [HandleUserInterface handleImage:@"tab_food"];
    //[foodListNC.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[HandleUserInterface getCommonColor],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
    
    //我的信息
    UserInfoViewController * userInfoVC = [[UserInfoViewController alloc]init];
    UINavigationController * userInfoNC = [[UINavigationController alloc]initWithRootViewController:userInfoVC];
    userInfoNC.navigationBar.barTintColor = [HandleUserInterface getCommonColor];
    userInfoNC.tabBarItem.title = @"我的信息";
    userInfoNC.tabBarItem.image = [UIImage imageNamed:@"tab_user"];
    //userInfoNC.tabBarItem.selectedImage = [HandleUserInterface handleImage:@"tab_user"];
    //[userInfoNC.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[HandleUserInterface getCommonColor],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
    
    self.viewControllers = @[newsListNC,knowledgeListNC,foodListNC,userInfoNC];
    
    [newsListVC release];
    [newsListNC release];
    
    [knowledgeListVC release];
    [knowledgeListNC release];
    
    [foodListVC release];
    [foodListNC release];
    
    [userInfoVC release];
    [userInfoNC release];
    
    
    
    
    self.tabBar.tintColor = UIColorCommon;
    //首次运行程序 欢迎界面
    //UIScrollView * welcomeView = [[UIScrollView alloc]initWithFrame:self.view.frame];
    //welcomeView.backgroundColor = [UIColor redColor];
    //[self.view addSubview:welcomeView];
    //[welcomeView removeFromSuperview];
    // Do any additional setup after loading the view.
    
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
